home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / programm.ing / ams__l~1.zoo / include / resoluti.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-09-11  |  2.0 KB  |  73 lines

  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. //  This file is part of the Atari Machine Specific Library,
  4. //  and is Copyright 1992 by Warwick W. Allison.
  5. //
  6. //  You are free to copy and modify these sources, provided you acknowledge
  7. //  the origin by retaining this notice, and adhere to the conditions
  8. //  described in the file COPYING.
  9. //
  10. //////////////////////////////////////////////////////////////////////////////
  11.  
  12. #ifndef _Resolution_h
  13. #define _Resolution_h
  14.  
  15. #include <bool.h>
  16.  
  17. class Resolution
  18. {
  19. public:
  20.     Resolution(); // Current
  21.     Resolution(int width, int height, int depth);
  22.  
  23.     int Width() const;
  24.     int Height() const;
  25.     int Depth() const;
  26.  
  27.     bool Usable() const;
  28.     void Use() const;
  29.  
  30.     short BitPlanes() const;
  31.     short BytesPerBitPlaneLine() const;
  32.     short BytesPerLine() const;
  33.     unsigned int NumberOfColours() const;
  34.     long Size() const; // in bytes.
  35.  
  36.     int operator==(const Resolution&) const;
  37.     int operator!=(const Resolution& R) const { return !operator==(R); }
  38.  
  39.     // The following are for implementation of old systems
  40.     // such as Degas "mode" bytes, etc.
  41.     Resolution(short); // As per old modes
  42.     short OldMode() const;  // as per Getrez(), but maybe -1 if not possible
  43.  
  44. private:
  45.     int w,h,d;
  46.     long mode;
  47. };
  48.  
  49.  
  50. extern const Resolution STLow;
  51. extern const Resolution STMedium;
  52. extern const Resolution STHigh;
  53.  
  54. extern const Resolution TTLow;
  55. extern const Resolution TTMedium;
  56. extern const Resolution TTHigh;
  57.  
  58. extern const Resolution MaximumResolution;
  59.  
  60.  
  61. inline int Resolution::Width() const { return w; }
  62. inline int Resolution::Height() const { return h; }
  63. inline int Resolution::Depth() const { return d; }
  64. inline short Resolution::BitPlanes() const { return d; }
  65. inline short Resolution::BytesPerBitPlaneLine() const { return w/8; }
  66. inline short Resolution::BytesPerLine() const { return w*d/8; }
  67. inline short Resolution::OldMode() const { return (mode&7) ? -1 : mode; }
  68. inline int Resolution::operator==(const Resolution& R) const { return mode==R.mode; }
  69.  
  70.  
  71. #endif
  72.  
  73.